package com.jinsi.controller.ylt;


import com.jinsi.constant.YltConstant;
import com.jinsi.pojo.SyUserAuditTurn;
import com.jinsi.service.ylt.TurnListService;
import com.jinsi.service.ylt.iml.TurnListServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jinsi.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName TurnListController
 * @Content 申请审核驳回列表Controller
 * @Author 姚龙腾
 * @Date 2022/10/12 11:53
 */
@RestController
@RequestMapping("/YltUser")
@Slf4j
public class TurnListController {
    @Autowired
    private TurnListService turnListService;

    /**
     * 获取全部驳回列表信息
     * @param page
     * @param limit
     * @return R
     */
    @RequestMapping("/AuditManage/getTurnList")
    public R getTurnList(Integer page, Integer limit){
        PageHelper.startPage(page,limit);
        List<SyUserAuditTurn> list = turnListService.getAll();
        PageInfo<SyUserAuditTurn> pageInfo = new PageInfo<>(list);
        return R.custom(YltConstant.LAYUI_CODE,
                YltConstant.LAYUI_MSG,
                pageInfo.getList(),
                pageInfo.getTotal());
    }


    /**
     * 根据输入信息进行模糊查询
     * @param page
     * @param limit
     * @param userName
     * @param userAccount
     * @param auditTime
     * @return R
     */
    @RequestMapping("/AuditManage/getTurnListByLike")
    public R getTurnListByLike(Integer page, Integer limit, String userName, String userAccount, String auditTime){
        PageHelper.startPage(page,limit);
        List<SyUserAuditTurn> list = turnListService.getAllByLike(userName, userAccount, auditTime);
        PageInfo<SyUserAuditTurn> pageInfo = new PageInfo<>(list);
        return R.custom(YltConstant.LAYUI_CODE,
                YltConstant.LAYUI_MSG,
                pageInfo.getList(),
                pageInfo.getTotal());
    }
}
